package repo

import (
	"errors"

	"clean/infra/config"
	repo_driver "clean/infra/repo/driver"
	"clean/usecase"
)


var drivers = make(map[string]repo_driver.Driver)

func Register(name string, d repo_driver.Driver) {
	drivers[name] = d
}

func Create(cfg config.Config) (*usecase.Repo, error) {
	d, ok := drivers[cfg.Dialect.Repo]
	if !ok {
		return nil, errors.New("xx")
	}
	return d.Create(cfg)
}
